package Demo04;

public class Test {
    public static void main(String[] args) {
        Generics<Integer> generics = new Generics<Integer>();
        generics.PushArray(0,1);
        generics.PushArray(1,2);

        Generics<String> generics1 = new Generics<String>();
        generics1.PushArray(0,"abc");
        generics1.PushArray(1,"efg");

        Generics<Double> arr = new Generics<>();
        Generics array = new Generics();
    }
}

class Generics<G> {
//    public G[] arr = new G[10];
    public Object[] arr = new Object[10];

    public void PushArray(int pos, G o) {
        arr[pos] = o;
    }

    public G GetArray(int pos) {
        return (G)arr[pos];
    }
}